<html> 
<head> 
    <script src="../OLLoader.js"></script>
    <script type="text/javascript">
    
    function test_read(t) {
        t.plan(2);

        var parser = new OpenLayers.Format.WCSDescribeCoverage();

        // Save original reader
        var _v1_1_0 = OpenLayers.Format.WCSDescribeCoverage.v1_1_0.prototype.read;

        OpenLayers.Format.WCSDescribeCoverage.v1_1_0.prototype.read = function() {
            t.ok(true, "Version 1.1.0 detected");
            return {};
        }

        var text =
            '<?xml version="1.0" encoding="UTF-8"?>' +
            '<CoverageDescriptions xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xsi:schemaLocation="http://www.opengis.net/wcs/1.1 http://schemas.opengis.net/wcs/1.1/wcsDescribeCoverage.xsd http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsAll.xsd">';

        var res = parser.read(text);
        t.eq(res.version, "1.1.0", "version 1.1.0 written to result object");

        // Restore original reader
        OpenLayers.Format.WCSDescribeCoverage.v1_1_0.prototype.read = _v1_1_0;
    }

    </script> 
</head> 
<body>
</body> 
</html>
